package controller.listeners.posCodeCorps;

import model.ManualCodeCorpTestModel;
import model.PosCodeCorpsModel;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

import dao.Center;

import business.ViewLogger;
import business.coding.CenterWeightAndWords;

import view.ManualCodeCorpTestView;
import view.PosCodeCorpsView;
import view.ViewUtils;

public class FilterKeyDownListener implements Listener {


	private PosCodeCorpsView _view;
	private PosCodeCorpsModel _model;
	
			public FilterKeyDownListener(PosCodeCorpsView view,
					PosCodeCorpsModel model) {
				this._model = model;
				this._view = view;
			}
			
			 public void handleEvent(Event event) {
				 if (event.character == '\r') {
					 	//Limpio centros, corps, etc
					 	 _model.reset();
					 	 
					 	 _model.setCorpFilter(_view.getCorpFilter());
					 	 _model.setProvFilter(_view.getProvFilter());
					 	 _model.setInstitFilter(_view.getInstitFilter());
					 	 _model.setOrgFilter(_view.getOrgFilter());
					 	 _model.setPosCodedDoneFilter(_view.getCodedDoneFilter());
				 
					 	 _model.next(false);
					 	 
					 	 _view.set_Corp(_model.get_corp());
					 	 _view.setCenters(_model.getCenters());
					 	 _view.set_PosCodedCenters(_model.get_poscodedCenters());
		            	
		           
		        }

			 }
}